package com.yykj.tencent.im.server.controller;

import com.yykj.tencent.im.server.bean.request.PortraitSetRequest;
import com.yykj.tencent.im.server.bean.response.PortraitGetResult;
import com.yykj.tencent.im.server.bean.response.PortraitSetResult;
import com.yykj.tencent.im.server.exception.TimException;
import com.yykj.tencent.im.server.form.UserProfileForm;
import com.yykj.tencent.im.server.service.ProfileService;
import com.yykj.tencent.im.server.utils.Constant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;


@RestController
@Slf4j
@Api(tags = "腾讯云通信--资料管理")
@RequestMapping("api/tencent/im/profile")
public class ProfileController {

    @Resource
    private ProfileService profileService;

    /**
     * 设置资料
     */
    @ApiOperation("设置账号资料")
    @PostMapping("/set")
    public PortraitSetResult setProfile(@RequestBody UserProfileForm form){
        return profileService.portraitSet(form);
    }

    @ApiOperation("拉取资料")
    @GetMapping("/get")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "账号ID", required = true, dataType = "String")
    })
    public PortraitGetResult getPortrait(@RequestParam String userId) {
        return profileService.getUserProfile(userId);
    }





}
